package work02.w5.model;

import java.text.SimpleDateFormat;
import java.util.Date;

public class ScheduleModel {
	/**
	 * 
	 * @param startTime
	 *            活动开始时间
	 * @param endTime
	 *            活动结束时间
	 * @param name
	 *            活动名称
	 * @param remark
	 *            活动备注，允许为空
	 * @param advancedNoticeMilisecond
	 *            活动提前提醒时间，必须>=0；
	 * @param frequence
	 *            活动频率,允许为空，自动填充为仅一次
	 */
	public ScheduleModel(Date startTime, Date endTime, String name,
			String remark, long advancedNoticeMilisecond,
			ScheduleFrequence frequence) {
		super();
		this.startTime = startTime;
		this.endTime = endTime;
		this.name = name;
		this.remark = remark;
		if (advancedNoticeMilisecond < 0)
			advancedNoticeMilisecond = 0;
		this.advancedNoticeMilisecond = advancedNoticeMilisecond;
		if (frequence != null)
			this.frequence = frequence;
	}

	/**
	 * 活动开始时间
	 */
	private Date startTime;
	/**
	 * 活动结束时间
	 */
	private Date endTime;
	/**
	 * 活动名称
	 */
	private String name;
	/**
	 * 活动备注
	 */
	private String remark;
	/**
	 * 提前通知时间
	 */
	private long advancedNoticeMilisecond;
	/**
	 * 活动频率,默认为仅1次
	 */
	private ScheduleFrequence frequence = ScheduleFrequence.OnlyOnce;

	/**
	 * @return 	  活动开始时间
	 */
	public Date getStartTime() {
		return startTime;
	}

	/**
	 * @return the endTime
	 */
	public Date getEndTime() {
		return endTime;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the remark
	 */
	public String getRemark() {
		return remark;
	}

	/**
	 * @return the advancedNoticeMilisecond
	 */
	public long getAdvancedNoticeMilisecond() {
		return advancedNoticeMilisecond;
	}

	/**
	 * @return the frequence
	 */
	public ScheduleFrequence getFrequence() {
		return frequence;
	}
	
	public String toString(){
		return formatHourAndMM.format(startTime)+"  "+getName();
	}
	private static SimpleDateFormat formatHourAndMM = new SimpleDateFormat("dd号 HH:mm");
}
